<template>
  <div>
    <view v-for="(val,index) in items" :key="index" class="card">
      <uni-card :title="codeFn(val.orderCode)" :extra="val.createTime">
        <p>收货人：{{val.userName}}</p>
        <p>联系电话：{{val.userPhone}}</p>
        <p>收货地址：{{val.address}}</p>
        <p>金额：{{val.totalPrice}}</p>
      </uni-card>
    </view>
  </div>
</template>
<script>
export default {
  data() {
    return {
      orders:[],
      items:[],
    }
  },
  mounted() {
    this.initFn()
  },
  methods: {
    codeFn(code){
      return '订单号：'+code
    },
    initFn(){
      let token = this.$store.state.token
      let searchUrl = 'http://39.106.224.223:8088/sellpart/order/querybyaccout'
      uni.request({
        url: searchUrl,
        header:{
          'content-type':'application/json',
          'Authorization':token
        },
        method:'GET',
        success:res=>{
            console.log(res);

          if (res.data.code == 200) {
            
            this.items = res.data.data
          }
        }
      })

    }
  },
}
</script>
<style lang="scss">
  .card{
    p{
      padding: 10rpx 0;
    }
  }
</style>